import request from '@/utils/request';

// 查询自己上传的辩题
export function getMyMotion(params) {
  return request({
    url: `/addDebateTopic/searchSelfDebateTopic/${params.pagenum}/${params.pagesize}/?uploaderId=${params.id}`,
    method: 'get'
  });
}

// 分页显示辩题
export function getAllMotion(params) {
  return request({
    url: `/addDebateTopic/look?pageNum=${params.pagenum}&pageSize=${params.pagesize}`,
    method: 'get'
  })
}

// 模糊查询辩题
export function searchMotion(params) {
  return request({
    url: `/addDebateTopic/search/${params.pagenum}/${params.pagesize}?title=${params.keyWords}`,
    method: 'get'
  })
}

// 修改自身辩题
export function updateMotion(data) {
  return request({
    url: `/addDebateTopic/updateDebateTopic`,
    method: 'put',
    data: data,
  })
}

// 新增辩题
export function addMotion(data) {
  return request({
    url: `/addDebateTopic/add`,
    method: 'post',
    data: data
  }) 
}

// 删除自身辩题
export function deleteMyMotion(params) {
  return request({
    url: `/addDebateTopic/deleteDebateTopic?debateTopicId=${params.debateTopicId}&uploaderId=${params.uploaderId}`,
    method: 'delete'
  })
}